"use strict"
var fs = require('fs')
var path = require('path')

module.exports = function(dir) {
  var handles = []

  if (!fs.existsSync(dir)) {
    return null
  }
  let files = fs.readdirSync(dir)
  files.forEach(function(filename) {
    var name = path.basename(filename, '.js')
    handles.push({
      type: name,
      handle: require(path.join(dir, '/' + filename))
    })
  })
  return handles
}